All Questions
Tagged with if-statementclean-code
2 questions
5votes
3answers
12kviews
Changing large number of if-elif-else statements to use underlying structure
I have a function that looks something like this: function_name(step, ... , typ): if typ == 'some type of calc method': if step == 1: do_me_at_step_1(...) elif step ...
2votes
2answers
353views
Highlighting importance of order when using short-circuited conditions
I was working on a piece of code when I noticed that an if statement could work or crash depending on the order used for the parts connected with and. You can replicate the problem like this: ...